﻿
namespace LFSRecord2.Model
{
    public class AudioLayerPropertyDouble : AudioLayerPropertyBase
    {
        public double DefaultValue { get; private set; }

        private double _currentValue = 0;
        public double CurrentValue
        {
            get { return (double)_currentValue; }
            set
            {
                if (value < MinValue)
                    value = MinValue;
                else if (value > MaxValue)
                    value = MaxValue;
                _currentValue = value;
                OnPropertyChanged("CurrentValue");
            }
        }

        public double MinValue = double.MinValue;
        public double MaxValue = double.MaxValue;

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }

        public AudioLayerPropertyDouble(AudioLayer parentLayer, int propertyIndex, string propertyName, double defaultValue, LayerPropertyValueMeaning propertyValueMeaning)
        {
            //_keyFrames = new List<CustomKeyFrame>();
            //KeyFrames = new SortableObservableCollection<CustomKeyFrame>(_keyFrames);

            ParentLayer = parentLayer;
            PropertyIndex = propertyIndex;
            PropertyName = propertyName;
            PropertyValueType = LayerPropertyValueTypes.Double;
            PropertyValueMeaning = propertyValueMeaning;
            DefaultValue = defaultValue;
            _currentValue = DefaultValue;
        }
    }
}
